# 加法计算器 　将为完成练习10-6而编写的代码放在
# 一个while 循环中，让用户犯错（输入的是文本而不是数）后
# 能够继续输入数。

# add_calculate.py
print("Give me two numbers, and I'll add them.")
print("Enter 'q' to quit.")

while True:
	first_number = input("\nFirst number: ")
	if first_number == 'q':
		break
	second_number = input("\nSecond number: ")
	if second_number == 'q':
		break

	try:
		answer = int(first_number) + int(second_number)
	except ValueError:
		print("Please enter the correct number.")
	else:	
		print(answer)